﻿using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ScoreGui : MonoBehaviour
{

    public Button replay;
    public Button exit;
    public Text win;
    public Text replayText;
    public Text exitText;
    public Text score;
    // Use this for initialization
    void Start ()
    {
        
        score.text = GlobalManager.score.ToString ();

        if (GlobalManager.win)
        {

            win.text = "Win";

            if (GlobalManager.level <= GlobalManager.maxLevel)
            {
                replayText.text = "Next Level";
            }

            if (GlobalManager.level > GlobalManager.maxLevel)
            {
                replayText.text = "Replay";
                GlobalManager.level = 1;
                GlobalManager.score = 0;
            }

        }
        else
        {
            win.text = "Lose";
            replayText.text = "Retry";
        }

    }
    
    // Update is called once per frame
    void Update ()
    {
        
    }

    public void Replay ()
    {
        Application.LoadLevel (1);
    }

    public void Exit ()
    {
        GlobalManager.level = 0;
        Application.LoadLevel (0);
    }
}
